package com.atguigu.tingshu.Factory;

import com.atguigu.tingshu.user.strategy.ItemTypeStrategy;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Map;

public class StrategyFactoryImpl implements StrategyFactory{
    @Autowired
    private Map<String , ItemTypeStrategy> strategyMap;
     @Override
    public ItemTypeStrategy getStrategy(String itemType) {

        if (!strategyMap.containsKey(itemType)){
            return null;
        }
        else {
            return strategyMap.get(itemType);
        }
    }
}
